package com.cloud.job;


import com.cloud.service.SyncCloudLogRecordService;
import com.cloud.service.SyncSysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class CronBatchSaveLogJob {

    @Autowired
    private SyncSysLogService syncSysLogService;
    @Autowired
    private SyncCloudLogRecordService syncCloudLogRecordService;

    /**
     * 为解决数据量不够预期长度，次日无法插入问题，设置每五分钟插入一次（即使数据量不够）
     */
    @Scheduled(cron = "0 */5 * * * ? ")
    public void execute() {
        //保存syslog表
        syncSysLogService.manualBatchSave();
        //保存cloudLogRecord表
        syncCloudLogRecordService.manualBatchSave();
    }
}
